define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'dict/index',
        add_url: 'dict/add',
        edit_url: 'dict/edit',
        delete_url: 'dict/delete',
        export_url: 'dict/export',
        modify_url: 'dict/modify',
        data_url: 'dict.data/index',
    };


    var Controller = {

        index: function () {

            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    // {field: 'id', title: 'id'},
                    {field: 'title', title: '字典名称'},
                    {field: 'type', title: '字典类型',search:false},
                    {field: 'remark', title: '备注',search:false},
                    {field: 'status', title: '状态',search:false, templet: ea.table.switch},
                    {field: 'create_time',search:false, title: '创建时间'},
                    {width: 250, title: '操作', templet: ea.table.tool, operat: [
                            [{
                                text: '数据管理',
                                url: init.data_url,
                                method: 'open',
                                auth: 'add',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                                extend: 'data-full="true"',
                            }, {
                                text: '编辑',
                                url: init.edit_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-success',
                                extend: 'data-full="true"',
                            }],
                            'delete'
                        ]},
                ]],
            });


            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});
